import numpy as np
from matplotlib import pyplot as plt
X = np.array([[ -0.074,   1.611],
      [  0.109,   0.518],
      [ -0.409,  -0.768],
      [  0.403,   1.099],
      [ -1.823,   1.338],
      [  0.243,  -0.76 ],
      [ -0.019,   1.758],
      [  0.186,   0.239],
      [-19.45 ,  -2.623],
      [ -1.064,   1.169],
      [ -0.167,  -1.403],
      [ -1.539,   0.776],
      [  0.544,  -2.012],
      [ -1.618,   0.932],
      [-16.217,   2.045],
      [ -0.209,   1.04 ],
      [ -0.838,   0.328],
      [ -0.212,  -2.112],
      [  0.63 ,  -0.486],
      [ -0.737,   0.234],
      [ -0.658,   0.044],
      [  0.541,   0.021],
      [ 10.21 ,  11.74 ],
      [ -0.256,  -1.17 ],
      [ -0.315,  -1.008],
      [ -1.236,   0.788],
      [  0.158,  -0.242],
      [-22.356, -19.31 ],
      [ -0.824,  -0.651],
      [ -0.368,   0.166],
      [ -0.284,   0.925],
      [  0.024,   0.145],
      [ -0.291,  -0.584],
      [ -0.997,   1.068],
      [  0.109,  -1.315],
      [  1.06 ,  -0.76 ],
      [ -0.633,  -1.025],
      [ -1.112,  -1.013],
      [  1.118,  -0.276]])

def ellipse_draw(A,b):
   t = np.linspace(0,2*np.pi,100)
   x = np.sin(t)
   y = np.cos(t)
   Y = np.vstack((x,y))
   s,V = np.linalg.eigh(A.T@A)
   X = V@np.diag(s**(-.5))@Y
   X = X-(np.linalg.inv(A)@b)[:,None]
   
   plt.plot(X[0,:],X[1,:],color='g',alpha=.5)